<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加文章</title>
    <!-- 引入Bootstrap CSS -->
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.2/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-3">
    <h2>添加文章</h2>
    <form th:action="@{/article/save}" method="POST">
        <div class="mb-3">
            <label for="title" class="form-label">标题</label>
            <input type="text" class="form-control" id="title" name="title" placeholder="标题" required>
        </div>

        <div class="mb-3">
            <label for="typeId" class="form-label">文章类型</label>
            <select class="form-select" id="typeId" name="typeId" required>
                <option value=""> -- 选择文章类型 -- </option>
                <option th:each="type : ${typeList}" th:value="${type.id}" th:text="${type.type}"></option>
            </select>
        </div>

        <div class="mb-3">
            <label for="content" class="form-label">内容</label>
            <textarea class="form-control" id="content" name="content" rows="6" placeholder="文章内容" required></textarea>
        </div>

        <button type="submit" class="btn btn-primary">保存</button>
        <a class="btn btn-secondary" th:href="@{/article/page?pageIndex=0}" role="button">取消</a>
    </form>
</div>
<!-- 引入Bootstrap JS -->
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.2/js/bootstrap.bundle.min.js"></script>
</body>
</html>